package com.service;

/**
 * @ClassName SuperFactory
 * @Description TODO
 * @Author Kx
 * @Date 2025/4/15 11:09
 * @Version 1.0
 */
public class SuperFactory {

    /***
     * @author: kx
     * @date: 2025/4/15 11:13
     * @param clazz : 对象
     * @return T
     * @description: 创建任意类型对象
    */
    public static <T> T createClass(Class<?> clazz) {
        try {
            // 通过反射创建对象
            return (T) clazz.getConstructor().newInstance();
        } catch (Exception e) {
            throw new RuntimeException("创建对象失败", e);
        }
    }
}
